<?php
// +----------------------------------------------------------------------
// | EtrolPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Author:LJQ <liujiqi@etrol.com>
// +-----------------------------------------------------------------------

namespace app\plan\model;

use app\common\model\Base;
use app\basic\model\Enterprise;
use app\basic\model\Staff;
use app\basic\model\Unit;
/**
 * 预案步骤管理
 */
class Script extends Base{
	

	protected $name = 'planstep';
	protected $createTime = 'createTime';
	protected $updateTime = 'updateTime';
	
	public $scriptTypeList=[] ;

	public  function getType(){

	 $scriptType=db('basicinfo')->where(array('sysCode'=>25))->column('subsystemName','subsystemNo');
	 $this->scriptTypeList=$scriptType;
	 return $this->scriptTypeList;
	}

	public function getActionIdNumAttr($value,$data){
		return $data['actionId'];
	}

	public function getactionIdAttr($value,$data){
		$this->getType();
		if($data['actionId']){
			return $this->scriptTypeList[$data['actionId']];
		}
		return null;
	}



	public function enterprise(){

		return $this->hasOne(Enterprise::class,'id','enterpriseId');

	}

	
	public function staff() {
		return $this->hasOne(Staff::class,'id','chargePerson');
	}


	public function unit() {
		return $this->hasOne(Unit::class,'id','enterpriseId');
	}
}